﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Quellenverwaltung.Word;

namespace Quellenverwaltung
{
	/// <summary>
	/// Interaktionslogik für EditConfiguration.xaml
	/// </summary>
	public partial class EditConfiguration : UserControl
	{
        private Quellenverwaltung.Word.Configuration configuration;
        public UI.Forms.ConfigurationHost HostForm;

		public EditConfiguration()
		{
			this.InitializeComponent();
            configuration = Configuration.getConfiguration();
            DataContext = configuration;
		}

        private void ButtonSetDefaults_Click(object sender, RoutedEventArgs e)
        {
            configuration.setDefaults();

            DataContext = null;
            configuration = null;
            configuration = Configuration.getConfiguration();
            DataContext = configuration;
            
        }

        private void ButtonSaveConfig_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                configuration.save();
                MessageBox.Show("Konfiguration wurde gespeichert");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler beim Speichern der Konfiguration: " + ex.Message);
            }
            
        }
	}
}